package com.kuaifu.autofare.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kuaifu.autofare.bean.model.ParkingLotCustomer;
import com.kuaifu.autofare.common.constants.ReturnCodeMsgConstants;
import com.kuaifu.autofare.dao.ParkingLotCustomerDao;
import com.kuaifu.autofare.dao.common.BaseDao;
import com.kuaifu.autofare.service.IParkingLotCustomerService;

@Service
public class ParkingLotCustomerServiceImpl extends BaseServiceImpl<ParkingLotCustomer> implements
		IParkingLotCustomerService {
	@Autowired
	private ParkingLotCustomerDao parkingLotCustomerDao;

	public BaseDao<ParkingLotCustomer> getBaseDao() {
		return parkingLotCustomerDao;
	}

	public Map<String, String> validParkLot(Integer parkLotId, String parkLotUuid) throws Exception {
		Map<String, String> resultMap = new HashMap<String, String>();
		ParkingLotCustomer parkingLot = get(parkLotId);
		if (parkingLot == null) {
			resultMap.put("resultCode", ReturnCodeMsgConstants.REQUEST_INVALID);
			resultMap.put("resultMsg", "停车场不存在!");
			return resultMap;
		} else {
			if (!parkingLot.getUuid().equals(parkLotUuid)) {
				resultMap.put("resultCode", ReturnCodeMsgConstants.REQUEST_INVALID);
				resultMap.put("resultMsg", "停车场信息不合法!");
				return resultMap;
			}
		}
		return resultMap;
	}
}
